﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace Northwind.ServiceObjects
{
    [Guid("3F7F70C3-F356-49F8-8871-5350F9376356")]
    public sealed class NorthwindServiceInstance : SPIisWebServiceInstance
    {
         //REFACTOR: read from resource or config?
        public static string ServiceInstanceDefaultDisplayName = "Northwind Service";
        public static string ServiceApplicationDefaultDisplayName = "Manages a Northwind Service";
        
        public static string DefaultName
        {
            get { return "Northwind Service"; }
        }

        #region Constructors
		public NorthwindServiceInstance()
		{
		}

		public NorthwindServiceInstance(SPServer server, NorthwindService service)
            : this(ServiceInstanceDefaultDisplayName, server, service)
		{
		}

		public NorthwindServiceInstance(string name, SPServer server, NorthwindService service)
			: base(server, service)
		{
			Name = name;
		}
        #endregion

        #region Overrides
        public override string DisplayName
        {
            get { return ServiceInstanceDefaultDisplayName; }
        }

        // NOTE: For TypeName we use 'Northwind Service' instead of 'NorthwindServiceInstance' (the default). It appears the type name
        // is displayed in the list of 'Services on Server' in the CA, not the DisplayName.
        public override string TypeName
        {
            get { return ServiceInstanceDefaultDisplayName; }
        }

        #endregion
   }
}
